package com.example.mqdemo.direct;

import jakarta.annotation.Resource;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.stereotype.Component;

/*
 *@description: 路由模式消息发送者
 *@author: hisen
 *@Time: 2023/11/23  18:07
 */
@Component
public class DirectProducer {

    @Resource
    AmqpTemplate amqpTemplate;

    public void sendErrorMessage(String message) {
        amqpTemplate.convertAndSend("directExchange", "error", message);
    }

    public void sendInfoMessage(String message) {
        amqpTemplate.convertAndSend("directExchange", "info", message);
    }
}
